#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uci.h>
#include <suci.h>

//extern int uci_caller = UCI_CALLER_TR;

int  main(int argc, char **argv)
{
	char value[64] = {0};
	char action[32]= {0};
	char uci_path[256]= {0};
	char uci_value[256]= {0};
	int ret = 0;

	strcpy(action, argv[1]);
	strcpy(uci_path, argv[2]);
	if(argc > 3)
		strcpy(uci_value, argv[3]);

	if(!strcmp(action, "get")){
		ret = do_uci_get(uci_path, uci_value);
		if(!ret)
			printf("do_uci_get %s success value=[%s]\n", uci_path, uci_value);
		else
			printf("do_uci_get %s error\n", uci_path);
	}
	else if(!strcmp(action, "set")){
        ret = do_uci_set(uci_path, uci_value);
		if(!ret)
        	printf("do_uci_set %s success value=[%s]\n", uci_path, uci_value);
		else
			printf("do_uci_set %s error\n", uci_path);
    } 
	else if(!strcmp(action, "commit")){
        ret = do_uci_commit(uci_path);
		if(!ret)
			printf("do_uci_commit %s success\n", uci_path);
		else
			printf("do_uci_commit %s error\n", uci_path);
    } 

	return 0;
}
